<%--
  Created by IntelliJ IDEA.
  User: asus
  Date: 2021/10/31
  Time: 15:19
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>登录</title>
    <script src="${pageContext.request.contextPath}/js/jquery-3.4.1.js"></script>

    <script>
        function a1() {
            $.post({
                url:"${pageContext.request.contextPath}/au",
                data:{"username":$("#username").val()},
                success:function (data) {
                    if (data.toString()==='ok'){
                        $("#usernameInfo").css("color","green");
                        $("#usernameInfo").html("ok");
                    }
                    else  {
                        $("#usernameInfo").css("color","red");
                        $("#usernameInfo").html("x");
                    }
                }
            });
        }
        function a2() {
            $.post({
                url:"${pageContext.request.contextPath}/ap",
                data:{"password":$("#password").val()},
                success:function (data) {
                    if (data.toString()==='ok'){
                        $("#passwordInfo").css("color","green");
                        $("#passwordInfo").html("ok");
                    }
                    else  {
                        $("#passwordInfo").css("color","red");
                        $("#passwordInfo").html("x");
                    }
                }
            });
        }
    </script>

</head>
<body>

用户名：<input type="text" id="username" onblur="a1()">
<span id="usernameInfo"></span>
<br>
密码：<input type="password" id="password" onblur="a2()">
<span id="passwordInfo"></span>

</body>
</html>
